const {SmsSchema} = require('../../model/UserSchema/User');

// 添加短信信息
exports.Add = function (arg) {
    return new Promise((resolve, reject) => {
        const smsModel = new SmsSchema({
            SmsType:arg.Account,
            SmsId: arg.PassWord,
            Account: arg.Token,
            agingTime: arg.NickName,
            SmsCode:arg.SmsCode
        })
        smsModel.save((error, result) => {
            if (error) return reject(error)
            resolve(result)
        })
    })
};

// 查询短信信息（单参数查询）
/*  可通过手机号,用户id查询
* */
exports.Sel_singleArg = function (arg) {
    return new Promise((resolve, reject) => {
        SmsSchema.find({...arg},(error, result) => {
            if (error) return reject(error)
            resolve(result)
        })
    })
};
